package com.zwl.springcloud.utlis;

import java.util.Random;
import java.util.UUID;

public class ChengguangUtlis {
    public static String getUUID(){
        UUID uuid=UUID.randomUUID();
        String str = uuid.toString();
        String uuidStr=str.replace("-", "");
        return uuidStr;
    }
    /***
     * 生成uid 8位数字
     */
    public static int generateUID(int id){
        Random random = new Random();
        String result="";
        for(int i=0;i<id;i++){
            //首字母不能为0
            result += (random.nextInt(id+1)+1);
        }
        return Integer.parseInt(result);
    }
}
